package com.eascs.ticket.ticket.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.eascs.ticket.common.service.BaseSevice;
import com.eascs.ticket.configuration.entity.TicketStatusConstant;
import com.eascs.ticket.configuration.entity.TicketTypeConstant;
import com.eascs.ticket.ticket.entity.Ticket;

@Service
public class TicketVersionService extends BaseSevice {

	public List<Object[]> getAllProjectVersionDataSource(String projectId) {
		return this.proxyDao.findObjectsList("select id,title from ticket where project_id=? and ticket_type_code=?   order by due_date,publish_prod_time, create_date", projectId, TicketTypeConstant.TICKET_TYPE_CODE_VERSION);
	}

	public List<Object[]> getValidProjectVersionDataSource(String projectId) {
		return this.proxyDao.findObjectsList("select id,title from ticket where project_id=? and status != ?  and status != ? and ticket_type_code=?  order by due_date,publish_prod_time, create_date", projectId, TicketStatusConstant.TICKET_STATUS_CLOSE, TicketStatusConstant.TICKET_STATUS_CANCEL,
				TicketTypeConstant.TICKET_TYPE_CODE_VERSION);
	}

	public List<Ticket> getAllNotCloseVersion() {
		return this.proxyDao.findEntitys("select t.* from ticket t where 1=1 and t.ticket_type_code=? and t.status not in (?) order by due_date,create_date", Ticket.class, TicketTypeConstant.TICKET_TYPE_CODE_VERSION, TicketStatusConstant.TICKET_STATUS_CLOSE);
	}

}
